home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 123 / cdrom123.iso / essenc / extens / imshow / Show Image.xpi / install.js next >
Encoding:
Text File  |  2004-10-29  |  1.7 KB  |  60 lines

  1. const APP_DISPLAY_NAME    = "Show Image";
  2. const APP_NAME            = "showimage";
  3. const APP_PACKAGE         = "showimage";
  4. const APP_VERSION         = "0.3";
  5.  
  6. const APP_JAR_FILE        = "chrome/showimage.jar";
  7. const APP_CONTENT_FOLDER  = "content/showimage/";
  8. const APP_LOCALE          = "en-US";
  9. const APP_LOCALE_FOLDER   = "locale/" + APP_LOCALE + "/showimage/";
  10.  
  11. const APP_SUCCESS_MESSAGE = "New menuitems will appear on the context menu of broken images.\n\n";
  12.  
  13. var chromef, chromeFlag;
  14.  
  15. initInstall(APP_NAME, APP_PACKAGE, APP_VERSION);
  16.  
  17. if (confirm("Do you want to install this into the profile directory?  (Cancel will install into your application directory)"))
  18. {
  19.    chromef = getFolder("Profile", "chrome");
  20.    chromeFlag = PROFILE_CHROME;
  21. }
  22. else
  23. {
  24.    chromef = getFolder("Chrome");
  25.    chromeFlag = DELAYED_CHROME;
  26. }
  27.  
  28. var err = addFile(APP_PACKAGE, APP_VERSION, APP_JAR_FILE, chromef, null);
  29.  
  30. if (err >= SUCCESS) 
  31.     var jar = getFolder(chromef, APP_JAR_FILE);
  32.  
  33.     registerChrome(CONTENT | chromeFlag, jar, APP_CONTENT_FOLDER);
  34.    registerChrome(LOCALE  | chromeFlag, jar, APP_LOCALE_FOLDER);
  35.  
  36.     err = performInstall();
  37.  
  38.     if(err >= SUCCESS) 
  39.    {
  40.         alert(APP_NAME + " " + APP_VERSION + " has been successfully installed.\n"
  41.             +APP_SUCCESS_MESSAGE
  42.             +"Please restart your browser before continuing.");
  43.     } 
  44.    else 
  45.    { 
  46.         alert("Install failed. Error code:" + err);
  47.         cancelInstall(err);
  48.     }
  49. else 
  50.     alert("Failed to create " +APP_JAR_FILE +"\n"
  51.         +"You probably don't have appropriate permissions \n"
  52.         +"(write access to phoenix/chrome directory). \n"
  53.         +"_____________________________\nError code:" + err);
  54.     cancelInstall(err);
  55. }
  56.  
  57.